/**
 * Created by yangchen on 2019/3/25
 * */
(function () {
  let fn = [];
  let run = function () {
    for (let i = 0; i < fn.length; i++) fn[i]();
  };
  document.ready = function (f) {
    if (fn.push(f) > 1) return;
    let t = setInterval(function () {
      if (/^(loaded|complete)$/.test(document.readyState)) {
        clearInterval(t);
        run();
      }
    }, 0);
  };
}());
